package com.slimbloody;

import io.prometheus.client.Histogram;
import io.prometheus.client.Summary;

public class GaugeMetric {
  static final Histogram requestDuration = Histogram.build()
    .name("http_request_duration_seconds")
    .help("HTTP request duration in seconds")
    .buckets(0.1, 0.5, 1, 2, 5) // 定义 Histogram 的 buckets
    .register();

  static final Summary requestLatency = Summary.build()
    .name("http_request_duration_seconds")
    .help("HTTP request latency in seconds.")
    .quantile(0.5, 0.05) // 统计50%分位数，最大允许误差为 ±5%
    .quantile(0.9, 0.01)
    .quantile(0.99, 0.001)
    .register();

  public static void main(String[] args) {
    requestDuration.observe(100);
    requestLatency.observe(100);
  }
}


